package com.twu.biblioteca;

/**
 * Created with IntelliJ IDEA.
 * User: Jaani Francis Nickolas
 * Date: 19/9/13
 * Time: 10:22 PM
 * To change this template use File | Settings | File Templates.
 */
public class Book
{
    private String id;
    private String category;
    private String title;
    private Integer edition;
    private String isbn;
    private String authorName;
    private Integer noOfCopies;
    private Double price;

    public Book(String temporaryId, String temporaryCategory, String temporaryTitle, Integer temporaryEdition, String temporaryIsbn, String temporaryAuthor, Integer temporaryCopies, Double temporaryPrice)
    {
        id = temporaryId;
        category = temporaryCategory;
        title = temporaryTitle;
        edition = temporaryEdition;
        isbn = temporaryIsbn;
        authorName = temporaryAuthor;
        noOfCopies = temporaryCopies;
        price = temporaryPrice;
    }
    public void displayBookDetails()
    {
        String displayText, gap = " ";
        displayText = id + gap + category + gap + title + gap + edition + gap;
        displayText += isbn + gap + authorName + gap ;
        displayText += noOfCopies.toString() + gap + price.toString();
        System.out.println(displayText);
    }

    public boolean compareBookID(String temporaryId)
    {
        if(temporaryId.equals(id))
            return true;
        return false;
    }

    public boolean checkAvailability()
    {
        if(noOfCopies > 0)
            return true;
        return false;
    }

    public void confirmReservation()
    {
        noOfCopies--;
    }
}
